package cn.myschool.admin.test;

import cn.myschool.dao.AdminDao;
import cn.myschool.entity.Admin;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Arrays;
import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class Aop1 {
    public static void main(String[] args) {
        ApplicationContext ac=new ClassPathXmlApplicationContext("aop.xml");
        AdminDao userDao = ac.getBean("userDao", AdminDao.class);
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>");
        String name = userDao.getClass().getName();
        System.out.println(name);
        System.out.println("父类:"+ userDao.getClass().getSuperclass());
        System.out.println("接口：");
        System.out.println(Arrays.toString(userDao.getClass().getInterfaces()));

        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>");
        int r=userDao.add(new Admin(100,"laowu","123",2));
        int r2=userDao.add(new Admin(100,"xiaoliu","455",2));
        int r3=userDao.add(new Admin(100,"admin","6666",6));

        List<Admin> l= userDao.search();
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>");
        System.out.println("search的结果是：");
        l.forEach(System.out::println);
    }
}
